package com.kk.permission.huawei.actionutil;

import android.accessibilityservice.AccessibilityService;
import android.view.accessibility.AccessibilityNodeInfo;

import com.kk.permission.accessibilityutils.NodeUtil;

import java.util.HashMap;
import java.util.Map;

public class HuaweiAccessibilityUtil {
    private final String STEP1 = "step1";
    private final String STEP2 = "step2";
    private final String STEP3 = "step3";
    private boolean result = false;
    private Map<String, String> stepMap = new HashMap();

    public boolean closeAccessibilityActivity(AccessibilityNodeInfo accessibilityNodeInfo, AccessibilityService accessibilityService) {
        if (this.result) {
            return true;
        }
        if ((NodeUtil.pageContains(accessibilityNodeInfo, "辅助功能") || NodeUtil.pageContains(accessibilityNodeInfo, "无障碍")) && !this.stepMap.containsKey("step1")) {
            this.result = true;
            this.stepMap.put("step1", "1");
            NodeUtil.back(accessibilityService);
        }
        return false;
    }
}
